package com.ioc.business.order.service.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.ioc.business.order.domain.PlanArrivalOrderItem;
import com.ioc.business.order.mapper.PlanArrivalOrderItemMapper;
import com.ioc.business.order.service.IPlanArrivalOrderItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ioc.common.constant.UserConstants;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 计划到货订单项表 服务实现类
 * </p>
 *
 * @author WeiZhongRong
 * @since 2025-01-08
 */
@Service
@AllArgsConstructor
public class PlanArrivalOrderItemServiceImpl extends ServiceImpl<PlanArrivalOrderItemMapper, PlanArrivalOrderItem> implements IPlanArrivalOrderItemService {

    @Override
    public List<PlanArrivalOrderItem> seletByPlanArrivalOrderId(Long planArrivalOrderId) {
        return new LambdaQueryChainWrapper<>(baseMapper)
                .eq(PlanArrivalOrderItem::getPlanArrivalOrderId, planArrivalOrderId)
                .eq(PlanArrivalOrderItem::getDelFlag, UserConstants.DEL_FLAG_NORMAL)
                .list();
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void deleteByPlanArrivalOrderIdList(List<Long> planArrivalOrderIdList) {
        baseMapper.deleteByPlanArrivalOrderIdList(planArrivalOrderIdList);
    }
}
